package com.sos.widget.app.dialog

import android.content.Context
import android.widget.EditText
import android.widget.TextView
import com.sos.widget.R
import com.sos.widget.databinding.DialogLoginBinding
import com.sos.widget.util.clickNoRepeat

/**
 * @Description
 * @Author 梁浩文
 * @Date 2023/3/7 17:44
 */
class DialogLogin(context: Context,phone: String,password: String, confirmCallBack: ((String, String) -> Any)) :
    BaseDialog.Builder<DialogLogin>(context) {
    init {
        setContentView(R.layout.dialog_login)
        DialogLoginBinding.bind(contentView)
        findViewById<EditText>(R.id.input_phone).setText(phone)
        findViewById<EditText>(R.id.input_psw).setText(password)
        findViewById<TextView>(R.id.tv_login).clickNoRepeat {
            val phone = findViewById<EditText>(R.id.input_phone).text.toString().trim()
            val psw = findViewById<EditText>(R.id.input_psw).text.toString().trim()
            confirmCallBack.invoke(phone, psw)
            dismiss()
        }
    }
}